<template>
		<view class="img_head_picture">
			<view class="bg_img">
				<image :src="general_top_bg" mode=""></image>
			</view>
			<view class="main_txt">
				<text class="title">{{header_title}}</text>
				<view class="title_bottom">
					<view class="img_box">
						<image  :src="customer_avatar"></image>
						<!-- <image v-else :src="headData.avatar" mode=""></image> -->
					</view>
					<view class="text_box">
						<text class="teacher-name">{{parent_name}}家长</text>
						<view class="statistical">
							<text>{{header_content}}</text>
						</view>
					</view>
				</view>
				<view v-if='showReturn' class="img-box-position" @click="return_back">
					<image  class="return-img" src="https://storage.ganorglobal.com/miniapp-service/static/fanhui.png" mode=""></image>返回
				</view>
			</view>
		</view>
</template>

<script>
	export default {
		props:{
			parent_name:{
				type: String,
				default: ''
			},
			header_content:{
				type: String,
				default: ''
			},
			showReturn:{
				type:Boolean,
				default: true
			},
			header_title:{
				type: String,
				default: ''
			},
			avatar :{ 
				type :String,
				default :''
			},
			url:{
				type: String,
				default : ''
			}
		},
		
		data(){
			return {
				customer_avatar : this.avatar ,
				general_top_bg: this.config.DEFAULT_CHIRDREN_TY
			}
		},
		mounted() {
			if(this.avatar){
				this.customer_avatar = this.avatar
			} else {
				this.customer_avatar = this.config.DEFAULT_CUSTOMER_AVATAR
			}
		},
		methods:{
			return_back(){
				console.log('headtop',this.url);
				if(this.url != '') {
					switch(this.url){
						case "care_index" : uni.switchTab({
							url:'../index',
							fail(e) {
								console.log(e);
							}
						})  ;break;
					}
				} else {
					uni.navigateBack({
						delta: 1
					});
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	
</style>
